package com.yh.patterns.adapter.twoWay_Adapter;

/**
 * @Auther:云尚学Java
 */
public class Adapter implements CatTarget,DogAdaptee{
    private DogAdaptee dogAdaptee;
    private CatTarget catTarget;
    public void setDogAdaptee(DogAdaptee dogAdaptee) {
        this.dogAdaptee = dogAdaptee;
    }
    public void setCatTarget(CatTarget catTarget) {
        this.catTarget = catTarget;
    }
    @Override
    public void catchMouse() {
        System.out.println("猫学狗叫");
        dogAdaptee.cry();
    }
    @Override
    public void cry() {
        System.out.println("狗学猫抓老鼠");
        catTarget.catchMouse();
    }
}
